home *** CD-ROM | disk | FTP | other *** search
- /*
- wbwm.c - Workbench Window Monitor
- 5/10/93 Bernhard Fastenrath
- */
-
- #include <dos.h>
- #include <signal.h>
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/intuition_pragmas.h>
-
- #include "wbwm.h"
- #include "jumptable.h"
-
- #if 0
- #define SEM_P struct SignalSemaphore *jt;\
- if (jt = FindSemaphore (JTName))\
- ObtainSemaphoreShared (jt);\
- else\
- return NULL
- #define SEM_V ReleaseSemaphore (jt)
- #else
- #define SEM_P while(0)
- #define SEM_V while(0)
- #endif
-
- DECLARE (CloseWindow)
- DECLARE (MoveWindow)
- DECLARE (OpenWindow)
- DECLARE (SizeWindow)
- DECLARE (WindowToBack)
- DECLARE (WindowToFront)
- DECLARE (ActivateWindow)
- DECLARE (MoveWindowInFrontOf)
- DECLARE (ChangeWindowBox)
- DECLARE (ZipWindow)
- DECLARE (OpenWindowTagList)
-
- extern UBYTE *JTName;
- extern struct IntuitionBase *IntuitionBase;
- extern ULONG WMSig;
- struct LVOTable LVOArray[] = { FUNCTIONS };
- static int event[] = { WINDOW_EVENTS };
- static int monitor_on = 0;
- static struct Task *my_task = NULL;
-
- int
- start_window_monitor ()
- {
- monitor_on = 1;
- my_task = FindTask (NULL);
- return InstallWedge ();
- }
-
- void
- stop_window_monitor ()
- {
- if (monitor_on)
- {
- monitor_on = 0;
- RemoveWedge ();
- }
- }
-
- /* It wouldn't be a good idea to call other functions because this
- code may be executed by any task and the other task's stack is used.
- */
- void __saveds monitor_event (int event) { Signal (my_task, WMSig); }
-
- /*
- * Intercepting Functions
- */
-
- LONG ASM
- CloseWindowR (ARGS)
- { int x; SEM_P; x = CloseWindowO (ALIST); monitor_event ( WE_CloseWindow ); SEM_V; return x; }
-
- LONG ASM
- MoveWindowR (ARGS)
- { int x; SEM_P; x = MoveWindowO (ALIST); monitor_event ( WE_MoveWindow ); SEM_V; return x; }
-
- LONG ASM
- OpenWindowR (ARGS)
- { int x; SEM_P; x = OpenWindowO (ALIST); monitor_event ( WE_OpenWindow ); SEM_V; return x; }
-
- LONG ASM
- SizeWindowR (ARGS)
- { int x; SEM_P; x = SizeWindowO (ALIST); monitor_event ( WE_SizeWindow ); SEM_V; return x; }
-
- LONG ASM
- WindowToBackR (ARGS)
- { int x; SEM_P; x = WindowToBackO (ALIST); monitor_event ( WE_WindowToBack ); SEM_V; return x; }
-
- LONG ASM
- WindowToFrontR (ARGS)
- { int x; SEM_P; x = WindowToFrontO (ALIST); monitor_event ( WE_WindowToFront ); SEM_V; return x; }
-
- LONG ASM
- ActivateWindowR (ARGS)
- { int x; SEM_P; x = ActivateWindowO (ALIST); monitor_event ( WE_ActivateWindow ); SEM_V; return x; }
-
- LONG ASM
- MoveWindowInFrontOfR (ARGS)
- { int x; SEM_P; x = MoveWindowInFrontOfO (ALIST); monitor_event ( WE_MoveWindowInFrontOf ); SEM_V; return x; }
-
- LONG ASM
- ChangeWindowBoxR (ARGS)
- { int x; SEM_P; x = ChangeWindowBoxO (ALIST); monitor_event ( WE_ChangeWindowBox ); SEM_V; return x; }
-
- LONG ASM
- ZipWindowR (ARGS)
- { int x; SEM_P; x = ZipWindowO (ALIST); monitor_event ( WE_ZipWindow ); SEM_V; return x; }
-
- LONG ASM
- OpenWindowTagListR (ARGS)
- { int x; SEM_P; x = OpenWindowTagListO (ALIST); monitor_event ( WE_OpenWindowTagList ); SEM_V; return x; }
-